package name.bingo.bing.pay.service.message.queue.service;/**
 * create by yanbing on 2018/11/14 16:59
 */

import com.alibaba.dubbo.config.annotation.Reference;
import name.bingo.bing.pay.service.trade.api.TradeWriteService;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 *
 * @param:
 * @return:
 * @auther: yanbing
 * @date: 2018/11/14 16:59
 **/
@Service
public class MessageService {
    @Reference
    private TradeWriteService tradeWriteService;

    public String handerBankMessage(String notifyMapJson){
        Map<String,Object> notifyMap = JSONObject.fromObject(notifyMapJson);
        //这里最好使用线程池来完成消息的处理
        //dubbo调用订单服务
        String orderResult = tradeWriteService.orderPaySuccess(notifyMap);
        //根据结果，确认掉消息
        return "ok";
    }
    public String handerAccountMessage(String notifyMapJson){
        Map<String,Object> notifyMap = JSONObject.fromObject(notifyMapJson);
        //这里最好使用线程池来完成消息的处理
        //dubbo调用会计服务
        System.out.println("调用会计服务");
        return "ok";
    }

}
